package edu.sctu.zcy.month201505.day20150526.homeworkchen;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;

/**
 * Created by user24 on 2015/5/26.
 */
public class DiningRoom {


    public int[] seat = new int[40];

    public int[] setSeat() {

        for (int i = 1; i < 40; i++) {
            seat[i] = i;
        }

        return seat;
    }

    public int getSeat() {

        int get = 0;

        lable:
        for (int i = 1; i < setSeat().length; i++) {

            int number = seat[(int) (Math.random() * setSeat().length)];
            if (setSeat()[number] == 2 * i) {

                System.out.println(number + "号座位上已有人,请重新选择！");
                continue lable;

            } else {
                get = number;
                System.out.println(get + "号座位可以坐");
                break lable;

            }
        }

        return get;
    }
}
